package tree;

/**
 * @author way
 * @create 2025-02-13 12:29
 */
public class _700_searchBST {
    public TreeNode searchBST(TreeNode root, int val) {
        if (root == null || root.val == val) return root;

        TreeNode res = null;
        if (root.val > val) res = searchBST(root.left, val);
        if (root.val < val) res = searchBST(root.right, val);
        return res;
    }
}
